import 'package:flutter/material.dart';

class ErrorView extends StatelessWidget {
  final Function retryAction;

  const ErrorView({super.key, required this.retryAction});

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: const EdgeInsets.fromLTRB(0, 0, 0, 80),
      color: Colors.white,
      width: double.infinity,
      height: double.infinity,
      child: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Image(
              image: AssetImage("assets/images/icon_error.png"),
              width: 120,
              height: 120,
            ),
            Container(
              margin: const EdgeInsets.fromLTRB(0, 20, 0, 0),
              child: const Text("获取数据失败~", style: TextStyle(color: Colors.grey)),
            ),
            Container(
              margin: const EdgeInsets.fromLTRB(0, 20, 0, 0),
              child: OutlinedButton(
                onPressed: () {
                  retryAction();
                },
                child: const Text(
                  "重新加载",
                  style: TextStyle(
                    color: Colors.grey,
                  ),
                ),
              ),
            )
          ],
        ),
      ),
    );
  }
}